# from flask import Flask
# from flask_cors import CORS
# from web.ppt import ppt
#
#
# def create_app():
#     app = Flask(__name__)
#     return app
#
#
# app = create_app()
# app.register_blueprint(ppt)
# CORS(app)


from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from web.ppt import ppt  # 假设原来的 ppt 是 Flask 的 Blueprint，这里应转换为 FastAPI 的 Router

def create_app():
    app = FastAPI()

    # CORS 设置
    app.add_middleware(
        CORSMiddleware,
        allow_origins=["*"],  # 允许所有来源（可根据需要修改）
        allow_credentials=True,
        allow_methods=["*"],
        allow_headers=["*"],
    )

    # 注册路由
    app.include_router(ppt)  # ppt_router 需按 FastAPI 格式重写

    return app

app = create_app()